<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
	
    <link href="../../../NCProjectWeb/css/bootstrap.min.css" rel="stylesheet">
	<link rel="stylesheet" href="../../../NCProjectWeb/css/bootstrap-datetimepicker.min.css">
	
	<title>Edit city</title>
</head>
<body>
	<%@ page import="entities.*" %>
	<%@ page import="java.util.ArrayList" %>
	<%@ page import = "java.util.Map" %>

<%
	ArrayList<Country> list = (ArrayList<Country>) request.getAttribute("countryList");
	Map<String, String> map = (Map<String, String>) request.getAttribute("map");

	String id = map.get("id");
	String action = map.get("action");
 	
 %>
	<form class="form-horizontal" method="Get" action="/NCProjectWeb/editCity">
		<input type="hidden" name="id" value="<%=id%>">
		<div class="controls" style="text-align: center;">
			<h3>Редактировать город</h3>
		</div>
		
		<div class="form-group">
			<label class="col-sm-2 control-label">Город</label> 
			<div class="col-sm-5">
				<input type="text" class="form-control" name="cityname" value="<%=map.get("cityname")%>">
				<input type="hidden" name="cityname" value="<%=map.get("cityname")%>">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label">Код города</label> 
			<div class="col-sm-5">
				<input type="text" class="form-control" name="citycode" value="<%=map.get("citycode")%>">
				<input type="hidden" name="citycode" value="<%=map.get("citycode")%>">
			</div>
		</div>
			
		<div class="form-group">
			<label class="col-sm-2 control-label">Страна</label>
			<div class="col-sm-5">
				<select class="form-control" name="citylocation">
				<% for (int i = 0; i < list.size(); i++) {
					if (list.get(i).getCountryName().equals(map.get("citylocation"))) {%>
					<option selected><%=list.get(i).getCountryName()%></option>
					<% } else {%>
					<option><%=list.get(i).getCountryName()%></option>
				<% } } %>
				</select>
			</div>
		</div>
		
		<div class="form-group">
			<div class="col-sm-3"></div>
			<input type="submit" class="btn btn-default" value="Редактировать">
			<a class="btn btn-default" href="${pageContext.request.contextPath}/admin/index.jsp" role="button">Home</a>
		</div>
	</form>

</body>
</html>